<%@ page contentType="text/html;charset=UTF-8" language="java"%><%@ page import="java.io.*"%><%@ page import="java.util.*" %><%@ page import ="java.text.*" %><%
		String fileName = (String)request.getAttribute("fileName");
		try {
			ByteArrayInputStream stream = (ByteArrayInputStream) request.getAttribute("outStream");
			BufferedInputStream inStream = new BufferedInputStream(stream);
			System.out.println("长度："+inStream.available());
			response.reset();
			response.setContentType("application/x-msdownload");
// 			fileName = java.net.URLEncoder.encode(fileName+".xls", "utf-8");		//IE支持此方式	 firefox不支持
// 			response.setHeader("Content-Disposition","attachment; filename=" + fileName);	
			fileName = new String(fileName.getBytes("GB2312"),"ISO-8859-1");
			response.addHeader("Content-Disposition","attachment;filename="+fileName+".xls");
			OutputStream sOut = response.getOutputStream();
			byte[] b = new byte[10*1024];
			int len = 0;
			while ((len = inStream.read(b)) != -1) {
				sOut.write(b, 0, len);
			}
			sOut.close();
			inStream.close();
		}catch (IOException ex) {
			ex.printStackTrace();
			System.out.println("Exception : downLoad.jsp " + ex.getMessage());
		}
%>